function ListNode(val) {
    this.val = val;
    this.next = null;
}
/**
 * @param {ListNode} head
 * @return {ListNode}
 */
var deleteDuplicates = function(head) {
    // 边界条件
    if (head == null || head.next == null) return head
    let cur = head
    while (cur.next) {
        if (cur.val == cur.next.val) {
            cur.next = cur.next.next
        }
        cur = cur.next
    }
    return head
};

let head = new ListNode(1)
head.next = new ListNode(1)
head.next.next = new ListNode(2)
console.log(deleteDuplicates(head))